﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace Data
{
    public class OthSql
    {
        private DataAccess Da = new DataAccess();
        public DataTable get_dt(string where)
        {
            if (where != null && where.Length > 0)
            {
                StringBuilder sbrSQL = new StringBuilder();
                sbrSQL.Append("Select * From [table] Where ");
                sbrSQL.Append(where);
                DataTable dt = Da.GetDataTable<Data.TInsert_Max>(sbrSQL.ToString());
                if (dt != null && dt.Rows.Count > 0)
                {
                    return dt;
                }
            }
            return null;
        }

        public List<Data.TInsert_Max> get_list(string strsearch1)
        {
            if (strsearch1 != null && strsearch1.Length>0)
            {
                StringBuilder sbrSQL = new StringBuilder();
                sbrSQL.Append("Select * From [] Where ");               
                sbrSQL.Append(" Order by Id ASC");
                DataTable dt = Da.GetDataTable<Data.TInsert_Max>(sbrSQL.ToString());
                if (dt != null && dt.Rows.Count > 0)
                {
                    return ConvertHelper<Data.TInsert_Max>.ConvertToModelList(dt);
                }
            }
            return null;
        }
    }
}
